package fragment;


import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;

import java.util.ArrayList;

import adapterdata.DrawerLayoutAdapter;
import datas.DrawerLayoutData;
import timor.timor.R;


public class DrawerlayoutFragment extends Fragment {

    private ListView listView;

    public DrawerlayoutFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_drawerlayout, container, false);

        LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.drawerlayoutfragment);
        linearLayout.getBackground().setAlpha(180);


        listView = (ListView) view.findViewById(R.id.drawerlayout_listview);
        init();
        return view;
    }

    public void init(){
        ArrayList<DrawerLayoutData> list=new ArrayList<>();
        int[] icon1={R.drawable.slide_my_order,R.drawable.slide_my_wallet,R.drawable.slide_vip,R.drawable.slide_resell,
                R.drawable.slide_qr,R.drawable.slide_help,R.drawable.slide_feedback,R.drawable.slide_setting};
        String[] data={"我的订单","我的钱包","会员专区","转卖闲置","扫一扫","帮助中心","意见反馈","设置"};
        int icon2=R.drawable.new_version_indicator;
        String[] data2={"买买买、卖卖卖","存小钱、买包包","每日签到领蘑豆","我的旧爱 她的新欢",null,null,null,null};
        for (int i = 0; i < 8; i++) {
            int image1 = icon1[i];
            String title = data[i];
            String message=data2[i];
            if(i==3){
                list.add(new DrawerLayoutData(image1,title,icon2,message));
            }else {
                list.add(new DrawerLayoutData(image1,title,message));
            }
        }
        DrawerLayoutAdapter drawerLayoutAdapter = new DrawerLayoutAdapter(getActivity(), list);
        listView.setAdapter(drawerLayoutAdapter);
    }



}
